package com.ruoyi.product.controller;


import com.ruoyi.common.core.domain.R;

import com.ruoyi.product.domain.dto.WorkOrderDto;
import com.ruoyi.product.service.WorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/workOrder")
public class WorkOrderController {
    @Autowired
    WorkOrderService workOrderService;

    @PostMapping("/getWorkOrderByPage")
    public R export(@RequestBody WorkOrderDto materialDto)
    {
        return R.ok(workOrderService.getWorkOrderByPage(materialDto));
    }

    @PostMapping("/addWorkOrder")
    public R addTest(@RequestBody WorkOrderDto materialDto){
        return R.ok(workOrderService.addWorkOrder(materialDto));
    }

    @PostMapping("/delWorkOrder")
    public R delTest(@RequestBody WorkOrderDto materialDto){
        workOrderService.delWorkOrder(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateWorkOrder")
    public R updateTest(@RequestBody WorkOrderDto materialDto){
        workOrderService.updateWorkOrder(materialDto);
        return R.ok("锁定成功");
    }

    @PostMapping("/getWorkOrderByCode")
    public R getWorkOrderByCode(@RequestBody WorkOrderDto materialDto){
        return R.ok(workOrderService.getWorkOrderByCode(materialDto));
    }
}
